package ploy.library;

import ploy.lang.*;

public class Cdr extends Closure {

    public Cdr( ) {
	super( 1 );
    }
    
    public DynamicObject invoke1( DynamicObject cons ) 
	throws RuntimeError {
	if ( cons.isPair() ) {
	    return ((Pair)cons).tail();
	} else {
	    throw new RuntimeError( "Attempt to take car of non-pair: " +
				    cons.toString() );
	}
    }
    

}
